//
//  CustomViewController.m
//  fruitsbuy3
//
//  Created by sgone-2 on 15/7/28.
//  Copyright (c) 2015年 sgone. All rights reserved.
//

#import "CustomViewController.h"
#import "HomeViewController.h"
#import "ProductViewController.h"
#import "PurchaseViewController.h"
#import "Common.h"
#import "Mine2ViewController.h"
#import "Home2ViewController.h"

@interface CustomViewController ()

@end

@implementation CustomViewController







- (void)viewWillAppear:(BOOL)animated
{
    [self setNeedsStatusBarAppearanceUpdate];
    
    
    [super viewDidLoad];
    
//    HomeViewController *home = [[HomeViewController alloc] init];
    Home2ViewController *home = [[Home2ViewController alloc]init];
    UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:home];
    nav1.navigationBar.hidden = YES;
    
   
    ProductViewController *pro = [[ProductViewController alloc] init];    UINavigationController *nav4 = [[UINavigationController alloc]initWithRootViewController:pro];
    nav4.navigationBar.hidden = YES;

    PurchaseViewController *pur = [[PurchaseViewController alloc]init];
    UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:pur];
    nav2.navigationBar.hidden = YES;
    
    
    
    
//    MineViewController *mine = [[MineViewController alloc]init];

    Mine2ViewController *mine = [[Mine2ViewController alloc]init];
    UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:mine];
    nav3.navigationBar.hidden = YES;
    

    
    self.viewControllers = @[nav2,nav1,nav4,nav3];
    
  
    
    

    
    self.tabBar.backgroundColor = [UIColor whiteColor];

    // 拿到 TabBar 在拿到想应的item
    UITabBar *tabBar = self.tabBar;
    UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
    UITabBarItem *item3 = [tabBar.items objectAtIndex:1];
    UITabBarItem*item1=[tabBar.items objectAtIndex:2];
    UITabBarItem*item2=[tabBar.items objectAtIndex:3];
    
    
    item0.selectedImage = [[UIImage imageNamed:@"tab1h"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];;
    item0.image = [[UIImage imageNamed:@"tab1n"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    item0.title=@"首页";
    
    item3.selectedImage = [[UIImage imageNamed:@"tab2h"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];;
    item3.image = [[UIImage imageNamed:@"tab2n"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    item3.title=@"订单";
    
    item1.selectedImage = [[UIImage imageNamed:@"tab3h"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];;
    item1.image = [[UIImage imageNamed:@"tab3n"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    item1.title=@"商品";
    
    
    item2.selectedImage = [[UIImage imageNamed:@"tab4h"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];;
    item2.image = [[UIImage imageNamed:@"tab4n"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    item2.title=@"我的";
    

    
    
    
    
    
    //设置选中与未选中的字体颜色
    [[UITabBarItem appearance]  setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor grayColor], NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];
    UIColor * titleHighlightedColor = BenSe_COLOR;
    
    [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:titleHighlightedColor, NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];
}



-(UIStatusBarStyle)preferredStatusBarStyle
{
    
   return UIStatusBarStyleLightContent;
    

    
    
}





@end
